<!-- About.vue文件 -->
<template>
 <div class="about-container">
    <h3>About组件</h3>
    <!-- 添加子路由链接和子路由视图 -->
    <!-- 子路由的路径是相对于父级路由的，所以在<router-link>中指定子路由时需要包含父级路由的路径前缀 -->
    <router-link to="/about/tab1/">tab1</router-link>
    <router-link to="/about/tab2">tab2</router-link>
    <hr>
    <router-view></router-view>

 </div>
</template>

<script setup>
// 在About组件中监听路由的变化
import { useRoute } from 'vue-router'
import { watch } from 'vue'
const route = useRoute()
watch(() => route.path, path => {
  console.log('路由路径', path)
})
</script>

<style scoped>
 .about-container{
    min-height: 10px;
    background-color: #f2f2f2;
    padding: 15px;
 }
 .about-container a {
 padding: 10px;
 border: 1px solid #ccc;
 border-radius: 5px;
 padding: 5px 10px;
 color: #000;
 margin: 0 5px;
}
.about-container a.router-link-active {
 color: #000;
 background-color: #deebf6;
}

</style>